﻿using System.Collections.Generic;
using BattleFury.Layers;
using Microsoft.Xna.Framework;

namespace BattleFury.Maps
{
	public abstract class BaseMap
		: IMap
	{
		public string Name { get; set; }
		public Vector2 Size { get; set; }
		public Vector3 Location { get; set; }
		public bool IsVisible { get; set; }
		public bool IsEnabled { get; set; }
		public List<ILayer> Layers { get; set; }

		protected BaseMap()
		{
			Name = string.Empty;
			Size = Vector2.Zero;
			Location = Vector3.Zero;
			Layers = new List<ILayer>();
			IsEnabled = true;
			IsVisible = true;
		}

		public virtual void Update(GameTime gameTime)
		{
			if (!IsEnabled) return;

			for (var i = 0; i < Layers.Count; i++)
			{
				var layer = Layers[i];
				layer.Update(gameTime);
			}
		}

		public virtual void Draw(GameTime gameTime)
		{
			if (!IsEnabled) return;

			for (var i = 0; i < Layers.Count; i++)
			{
				var layer = Layers[i];
				layer.Draw(gameTime);
			}
		}
	}
}